import axios from 'axios';
import React, {useEffect ,useState} from 'react';
import {useParams,useNavigate} from 'react-router-dom'
const Index = () => {
    const navigate =useNavigate()
    let params =useParams();
    const [musics,setMusic] =useState({})
    const fecthData =async ()=>{
        var res =await axios.get(`http://122.112.161.135:4000/api/movieDetail?id=${params.id}`)
        setMusic(res.data.res[0])
    }
    useEffect(()=>{
        fecthData();
    },[])
    return (
        <div >
            <img onClick={()=>{navigate(-1)}} src={musics.pic} alt="" />
            <p>{musics.title}</p>
            
        </div>
    );
}

export default Index;
